#include "maingraphicsview.h"

MainGraphicsView::MainGraphicsView(QWidget* parent) : QGraphicsView(parent)
{
    setRenderHint(QPainter::Antialiasing);
    setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
}

void MainGraphicsView::wheelEvent(QWheelEvent* event)
{
    // 使用滚轮进行缩放
    if (event->angleDelta().y() > 0)
        scale(1.2, 1.2);  // 放大
    else
        scale(0.8, 0.8);  // 缩小
    emit wheelScale();
}
